import service from "../config";

// 知识库列表
export function fetchKnowledgeBases() {
    return service({
        url: "/knowledge/bases/",
        method:"GET"
    });
}

// 默认知识库
export function fetchDefaultKnowledgeBase() {
    return service({
        url: "/knowledge/bases/default/",
        method: "GET"
    });
}

// 创建知识库
export function createKnowledgeBase(data) {
    return service({
        url: "/knowledge/bases/",
        method: "POST",
        data
    });
}

// 知识库文档列表
export function fetchKnowledgeDocuments(params = {}) {
    return service({
        url: "/knowledge/documents/",
        method: "GET",
        params
    });
}

// 上传知识库文档
export function uploadKnowledgeDocument(formData) {
    return service({
        url: "/knowledge/documents/upload/",
        method: "POST",
        data: formData,
        headers: {
            "Content-Type": "multipart/form-data"
        }
    });
}
